home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CPPTASK.ARJ / TSKLOCAL.HPP < prev    next >
C/C++ Source or Header  |  1991-08-21  |  2KB  |  96 lines

  1. /*
  2.    CPPTask - A Multitasking Kernel For C++
  3.  
  4.    TSKLOCAL.HPP - Internal definitions and prototypes.
  5.  
  6.    Version 1.0 08-12-91
  7.  
  8.    Ported by Rich Smith from:
  9.  
  10.    Public Domain Software written by
  11.       Thomas Wagner
  12.       Patschkauer Weg 31
  13.       D-1000 Berlin 33
  14.       West Germany
  15. */
  16.  
  17. /*
  18.    struct task_stack describes the contents of a tasks stack after creation.
  19.    The first 10 words are the registers to be restored by the scheduler.
  20.    Only the segment registers are significant initially.
  21.    The next three words contain the function address plus the CPU flags
  22.    setup as if an interrupt had occurred at the function's entry address.
  23.  
  24.    This setup is the same as the stack of an interrupted task after
  25.    scheduling.
  26.  
  27.    The following two words contain a dummy return address, which points
  28.    to the routine "killretn". Thus, if the task main function should ever
  29.    return, the task is automatically killed. The last doubleword is
  30.    used for the optional argument to the task.
  31. */
  32.  
  33. struct task_stack {
  34.    word     r_es;
  35.    word     r_ds;
  36.    word     r_di;
  37.    word     r_si;
  38.    word     r_bp;
  39.    word     r_sp;
  40.    word     r_bx;
  41.    word     r_dx;
  42.    word     r_cx;
  43.    word     r_ax;
  44.    funcptr  retn;
  45.    word     r_flags;
  46.    funcptr  dummyret;
  47.    farptr   arg;
  48. };
  49.  
  50. extern tcbptr    tsk_eligible;
  51. extern tcbptr    tsk_current;
  52. extern tlinkptr  tsk_timer;
  53. extern byte      tsk_preempt;
  54. extern byte      tsk_pretick;
  55.  
  56. #if (CLOCK_MSEC)
  57. extern dword tsk_timeout (dword tout);
  58. extern double tick_factor;
  59. #else
  60. #define tsk_timeout(tout)  tout
  61. #endif
  62.  
  63. // externals from tsktim.asm
  64.  
  65. extern "C" void far tsk_install_timer (word divisor, word sys_ticks);
  66. extern "C" void far tsk_remove_timer (void);
  67. extern "C" void far tsk_chain_timer (void);
  68.  
  69. // externals from tskdos.asm
  70.  
  71. extern "C" void far tsk_install_dos (void);
  72. extern "C" void far tsk_remove_dos (void);
  73.  
  74. // externals from tskkbd.asm
  75.  
  76. extern "C" void far tsk_install_kbd (void);
  77. extern "C" void far tsk_remove_kbd (void);
  78. extern "C" word far t_read_key (void);
  79. extern "C" word far t_wait_key (dword timeout);
  80. extern "C" word far t_keyhit (void);
  81.  
  82. // externals from tskbios.asm
  83.  
  84. extern "C" void far tsk_install_bios (void);
  85. extern "C" void far tsk_remove_bios (void);
  86.  
  87. #define tsk_dseg()   _DS
  88.  
  89. // external from tskasm.asm
  90.  
  91. extern "C" word far tsk_flags (void);
  92.  
  93. extern void far tsk_wait (tqueptr que, dword timeout);
  94.  
  95.  
  96.